﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CoreProvince;

namespace BatDongSan
{
    public partial class NhaDatDetail : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                int idPlace = Convert.ToInt32(Request.QueryString["id"]);
                if (idPlace > 0)
                {
                    int loai = (int)PlaceBll.GetVGNhaDatById(idPlace, Utility.strConnect).NhaDatId;
                    if (loai == 1)//Can ban
                    {
                        Advertisement1.LoadBannerList(8, 1, "180", "0");
                        NhaDatBan.LoadNhaDat(1);
                        NhaDatChoThue.LoadNhaDat(2);
                    }
                    else if (loai == 2)//cho thue
                    {
                        Advertisement1.LoadBannerList(9, 1, "180", "0");
                        NhaDatBan.LoadNhaDat(1);
                        NhaDatChoThue.LoadNhaDat(2);
                    }
                    else if (loai == 3)//can mua
                    {
                        Advertisement1.LoadBannerList(12, 1, "180", "0");
                        NhaDatBan.LoadNhaDat(3);
                        NhaDatChoThue.LoadNhaDat(4);
                    }
                    else if (loai == 4)//can cho thue
                    {
                        Advertisement1.LoadBannerList(13, 1, "180", "0");
                        NhaDatBan.LoadNhaDat(3);
                        NhaDatChoThue.LoadNhaDat(4);
                    }
                    else
                    {
                        Advertisement1.LoadBannerList(8, 1, "180", "0");
                        NhaDatBan.LoadNhaDat(1);
                        NhaDatChoThue.LoadNhaDat(2);
                    }
                }
                else
                {
                    Advertisement1.LoadBannerList(8, 1, "180", "0");
                    NhaDatBan.LoadNhaDat(1);
                    NhaDatChoThue.LoadNhaDat(2);
                }

                //NhaDatBan.LoadNhaDat(1);
                //NhaDatChoThue.LoadNhaDat(2);
                //NhaDatCanMua.LoadNhaDat(3);
                //NhaDatCanThue.LoadNhaDat(4);
            }
        }
    }
}